<template>
    <div class="layout-pd">
        <zh-space style="padding-top: 10px">
            <zh-card title="查询条件">
                <zh-form ref="queryFormRef" :model="state.queryParam" label-width="150px">
                    <zh-form-input prop="fullName" label="姓名" placeholder="支持模糊查询" v-model="state.queryParam.fullName"></zh-form-input>
                    <zh-form-date prop="actionTimeStart" label="禁用时间" format="YYYY-MM-DD" v-model="state.queryParam.actionTimeStart" ></zh-form-date>
                    <zh-form-date prop="actionTimeEnd" label="至" format="YYYY-MM-DD" v-model="state.queryParam.actionTimeEnd" ></zh-form-date>
                </zh-form>
                <zh-form-query :showAdvanced="false" :form-ref="queryFormRef"  @queryClick="queryClick"  @reset="queryReset" style="float: right">
                </zh-form-query>
            </zh-card>
            <zh-table
                ref="tableRef"
                title="禁用列表"
                :height="550"
                :cryptoEnabled="true"
                funcCode="sysDisableLog0001"
                :columns="state.tableColumn"
                highlight-current-row
            >
            </zh-table>
        </zh-space>
    </div>
</template>

<script setup lang="ts">

const queryFormRef = ref({})
const tableRef = ref({})

const state = reactive({
    queryParam: {
        fullName: '',
        actionTimeStart: null,
        actionTimeEnd: null,
    },
    tableColumn: [
        {type: 'seq', width: 80, fixed: 'left', align: 'center', title: '序号'},
        {field: 'fullName', title: '姓名', align: 'center', minWidth: 150},
        {field: 'actionTime', title: '禁用时间', align: 'center', minWidth: 150},
        {field: 'reason', title: '禁用原因', align: 'center', minWidth: 350},
    ],
})

onMounted(()=>{
    tableRef.value.query(state.queryParam)
})

function queryClick(){
    if(state.queryParam.actionTimeStart && state.queryParam.actionTimeEnd){
        if(state.queryParam.actionTimeStart > state.queryParam.actionTimeEnd){
            $messageBox.warning('查询开始时间不能大于结束时间','系统提示');
            return;
        }
    }
    tableRef.value.query(state.queryParam)
}

function queryReset(){
    queryFormRef.value.resetFields();
    tableRef.value.query(state.queryParam)
}
</script>

<style scoped lang="scss">

</style>